<html>
<head>
<link rel="stylesheet" href="css/enginetable.css" type="text/css">

<script type="text/javascript">
	function myclear(state) {
		var chks=document.getElementsByName('egicon');
		for(var i=0; i< chks.length; ++i) {
			chks[i].checked=state;
		}
		parent.allclear(state);
	}

function initList() {    
    var egs=localStorage.getItem("searchEngines");
    if(egs=='') egs=new Array();
    else egs=egs.split(',');
    myclear(false);
    for(var i=0; i<egs.length; ++i) {
        var inuse = document.getElementById(egs[i]);
        inuse.checked=true;
        parent.createIMG(egs[i]);
    } 
}

function clearWithPreview(state) {
	myclear(state);
	parent.preview();
}

</script>
</head>
<body><center>
<button type="button" onclick='clearWithPreview(true)'>Select All</button>
<button type="button" onclick='clearWithPreview(false)'>Clear</button>

<table id="egsTable" border="1">
  <thead><tr>
    <th> </th>
    <th>Logo</th>
    <th>Search Engine Name</th>
  </tr></thead>
  <tbody><tr></tr><tbody>
</table>
<button type="button" onclick='clearWithPreview(true)'>Select All</button>
<button type="button" onclick='clearWithPreview(false)'>Clear</button>

<script type="text/javascript">
	var egsTable = document.getElementById('egsTable');
	var eList=parent.EnginesList;
	var odd=false;
		for(var engine in eList) {
		var row=egsTable.insertRow(egsTable.rows.length);
		if(odd) row.className="odd";
		odd=~odd;
		var chk=row.insertCell(0);
		var logo=row.insertCell(1);
		var egDesc=row.insertCell(2);
		chk.innerHTML='<input type="checkbox" name="egicon" id="'+engine+'" value ="'+engine+'" onchange="parent.setup(this)">';
		
		logo.innerHTML='<img src="img/'+engine+'.png" width="24" height="24" />';
		
		egDesc.innerHTML=eList[engine];
	}

initList();
</script>

</center></body>
</html>
